<template>
  <section>
    <van-nav-bar title="设置" fixed placeholder safe-area-inset-top />
  </section>
  <!-- 志愿者端的个人信息 -->
  <UserInfoSettings>
    <!-- 个人资料 -->
    <van-cell-group title="个人资料" inset>
      <van-cell title="个人详细信息" value="" clickable is-link :to="{ name: 'UserDetails' }" />
      <van-cell title="修改密码" value="" clickable is-link :to="{ name: 'UserChangePassword' }" />
    </van-cell-group>

    <!-- 支持和反馈 -->
    <van-cell-group title="反馈建议与意见" inset>
      <van-cell title="反馈意见" value="" clickable is-link :to="{ name: 'UserFeedback' }" />
    </van-cell-group>
  </UserInfoSettings>

  <!-- 退出 -->
  <van-button v-if="userStore.userInfo.types === 1" block class="logout" @click="logout">退出</van-button>
</template>

<script setup>
import UserInfoSettings from '@/components/UserInfoSettings.vue';
import useUserStore from '@/store/user';
import { showConfirmDialog } from 'vant';

const userStore = useUserStore()

const logout = () => {
  showConfirmDialog({
    title: '提示',
    message: '确定登出？',
  }).then(() => {
    userStore.userLogout()
  }).catch(() => {
  })
}
</script>

<style scoped>
.logout {
  position: fixed;
  bottom: 65px;
  width: 94vw;
  margin: 0 3vw;
}
</style>
